package com.wujilin.okra.loader;

import android.content.Context;

import com.wujilin.okra.database.CursorHandler;
import com.wujilin.okra.database.Sql;

public class QueryLoader<T> extends DataLoader<T> {
	private String sql;
	private CursorHandler<T> handler;
	private String[] args;
	
	public QueryLoader(Context context, String sql, CursorHandler<T> handler, String... args) {
		super(context);
		this.sql = sql;
		this.handler = handler;
		this.args = args;
	}

	@Override
	public T loadInBackground() {
		return Sql.query(sql, handler, args);
	}
}
